package com.android.RssReader.Screen;

import android.app.Activity;
import android.view.KeyEvent;
import android.view.Menu;

import com.android.RssReader.Service.ServiceManager;

public class Screen extends Activity implements IScreen{
	
	protected String id;
	protected final SCREEN_TYPE type;
	protected boolean computeConfiguration;
	
	protected Screen(SCREEN_TYPE type, String id) {
		this.type = type;
		this.id = id;
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 && this.type != SCREEN_TYPE.SCREEN_HOME_T) {
			ServiceManager.getScreenservice().back();
			return true;
		}
		else if(keyCode == KeyEvent.KEYCODE_MENU && event.getRepeatCount() == 0){
			if(!this.haveMenu()){
				return true;
			}
		}
		return super.onKeyDown(keyCode, event);
	}

	public String getScreenTitle() {
		return this.getId();
	}

	@Override
	public boolean haveMenu(){
		return false;
	}
	
	public boolean createOptionsMenu(Menu menu){
		return false;
	}
	
	public String getId() {
		return this.id;
	}
	
	@Override
	public SCREEN_TYPE getType(){
		return this.type;
	}

	
}
